Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 11483 - Code Creator / codecoder.cpp
blobed971d6faefcc932b1b2b2686f421689b1466816
1 #include <iostream>
2 #include <string>
3 #include <vector>
5 using namespace std;
7 int main() {
8 int cases;
9 string header="#include<string.h>\n#include<stdio.h>\nint main()\n{\n";
10 string cola="printf(\"\\n\");\nreturn 0;\n}\n";
11 int n=0;
12 while(cin >> cases && cases){
13 cout<<"Case "<<++n<<":"<<endl;
14 cout<<header;
15 string ans;
16 getline(cin,ans);
17 while(cases--){
18 getline(cin,ans);
19 if(ans==""){
20 cases++;
21 continue;
24 for(int i=0;i<ans.size();++i){
25 //cout<<"debug"<<endl;
26 if(ans[i]=='\\'){
27 ans.insert(i+1,"\\");
28 ++i;
29 }else if(ans[i]=='"'){
30 //ans[i]='';
31 ans.insert(i,"\\");
32 ++i;
33 }else if(ans[i]=='"'){
34 ans.insert(i,"\\");
35 ++i;
38 cout<<"printf(\""<<ans<<"\\n\");"<<endl;
40 cout<<cola;
42 //getchar();
43 return 0;